Skip to content

feat(telemetry): opt-in anonymous learning-funnel events - #94

Open
OthmaneZ05 wants to merge 1 commit into
mainfrom
feat/opt-in-telemetry
Open

feat(telemetry): opt-in anonymous learning-funnel events#94
OthmaneZ05 wants to merge 1 commit into
mainfrom
feat/opt-in-telemetry

Conversation

@OthmaneZ05

Copy link
Copy Markdown
Collaborator

Summary of Changes

Adds strictly opt-in, anonymous product telemetry for the learning funnel. Five custom events (roadmap_started, step_validated, step_failed, roadmap_completed, roadmap_abandoned) are sent as Plausible-format custom events to a build-time-configurable endpoint (VITE_TELEMETRY_ENDPOINT / VITE_TELEMETRY_DOMAIN; an empty endpoint hard-disables telemetry entirely).

  • Consent is tri-state (unset / accepted / declined, localStorage key torollo_telemetry_consent): anything other than an explicit accept means zero network requests. A one-time, non-blocking consent card on the home screen asks the question; a header toggle makes the choice reversible at any time.
  • Anonymous by construction: payloads carry only the catalogue roadmap id, step id, app version and a random locally-generated install id. Revoking consent deletes the install id, so re-enabling starts a fresh identity. No PII, no project names, no server-side collector in this repo.
  • Honest counting: step_failed only counts pedagogical failures — validator runs that end in an engine error (e.g. Docker unreachable) are not counted; roadmap_started only fires when the backend progress store is confirmed empty; roadmap_completed fires once, on the validation that completes the roadmap; roadmap_abandoned fires once per play-through on close/unmount/pagehide (with keepalive so it survives tab close).
  • New README Telemetry section documents the exact event list, payload contents, and how to decline/revoke.

Types of Changes

  • New feature / node type addition
  • Bug fix (non-breaking change resolving an issue)
  • Refactoring / structural cleanup
  • Documentation update

Verification & Testing

Automated Checks

  • Run npm run lint successfully with no errors
  • Run npm run build successfully with no compilation errors
  • Run npm test successfully (all tests pass)

322 frontend tests pass, including new suites: consent store (tri-state, install-id lifecycle, storage-disabled fallback), trackEvent (zero fetch calls when declined/unset, exact payload prop allowlist, keepalive passthrough, never throws on network failure), and the player hook wiring for all five events (including the no-restart-on-resume and no-abandon-after-completion negatives).

Manual Verification

Full E2E run against the real backend + real Docker with a local Plausible-shaped capture server and Playwright driving the UI (20/20 checks):

  • Declined: played a real roadmap (open, validate against real containers, close) — zero requests on the wire, asserted from the browser's request log, not just the capture file.
  • Accepted via the header toggle: all five events arrived for real — fresh open (roadmap_started), a real validator pass (step_validated), a real fail on a missing container (step_failed), closing mid-roadmap (roadmap_abandoned with the correct step id), and creating the missing container then validating (step_validated + roadmap_completed).
  • Negatives: reopening with saved progress fires no second roadmap_started; closing a completed roadmap fires no roadmap_abandoned.
  • Payload audit across all captured events: props limited to roadmap/step/install_id/app_version, one stable random install id, configured domain honoured, no PII strings.
  • Consent card and toggle verified visually in light and dark themes.
  • Production pipeline smoke-tested: a test event POSTed with the app's exact payload shape was accepted (202) by the production Plausible instance and appears in the dashboard.

Checklist

  • My code follows the repository's code style and lint standards
  • I have updated the documentation or instructions if necessary
  • All unit and integration tests are passing

🤖 Generated with Claude Code

@OthmaneZ05
OthmaneZ05 requested a review from Derssa as a code owner August 20, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant